﻿using System;
using System.Collections.Generic;
using System.Data.Common;

namespace UPos.Core.Entity
{
    public class Sale
    {
        public string FID { get; set; }

        public DateTime BizDate { get; set; }

        public string MachineNo { get; set; }

        public string BillNumber { get; set; }

        public string CreaterNumber { get; set; }

        public string CreaterName { get; set; }

        public Decimal Amount { get; set; }

        public Decimal Paymentmoney { get; set; }

        public DateTime UpDate { get; set; }

        public List<SaleEntry> SaleItems { get; set; }

        public List<ReceiveEntries> ReceiveItems { get; set; }

        public Sale() { }

        public Sale(DbDataReader reader)
        {
            FID             = reader.GetString(reader.GetOrdinal("FID"));
            BizDate         = reader.GetDateTime(reader.GetOrdinal("BizDate"));
            MachineNo       = reader.GetString(reader.GetOrdinal("MachineNo"));
            BillNumber      = reader.GetString(reader.GetOrdinal("BillNumber"));
            CreaterNumber   = reader.GetString(reader.GetOrdinal("CreaterNumber"));
            CreaterName     = reader.GetString(reader.GetOrdinal("CreaterName"));
            Amount          = reader.GetDecimal(reader.GetOrdinal("Amount"));
            Paymentmoney    = reader.GetDecimal(reader.GetOrdinal("Paymentmoney"));
            try
            {
                UpDate = reader.GetDateTime(reader.GetOrdinal("UpDate"));
            }
            catch (Exception)
            { }
        }
    }
}
